package com.zuowei.ycy.user.adapter;

import android.content.Context;
import android.view.View;

import com.and.yzy.frame.adapter.CommonAdapter;
import com.and.yzy.frame.adapter.ViewHolder;
import com.zuowei.ycy.R;
import com.zuowei.ycy.user.domain.OrderDetailsInfo;

import java.util.List;

/**
 * 外卖订单已选列表
 */
public class OrderGoodsAdapter extends CommonAdapter<OrderDetailsInfo.GoodsListBean> {
    public OrderGoodsAdapter(Context context, List<OrderDetailsInfo.GoodsListBean> mList, int itemLayoutId) {
        super(context, mList, itemLayoutId);
    }

    @Override
    public void convert(ViewHolder holder, OrderDetailsInfo.GoodsListBean item, int positon) {

        holder.setTextViewText(R.id.tv_name, item.getGoods_name());
        holder.setTextViewText(R.id.tv_buy_num, "x" + item.getNumber());
        holder.setTextViewText(R.id.tv_price, "¥ " + item.getGoods_price());

        if (positon == getCount() - 1) {
            holder.setViewVisibility(R.id.v_divier, View.INVISIBLE);
        } else {
            holder.setViewVisibility(R.id.v_divier, View.VISIBLE);
        }
    }
}
